-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use defer to release the lock.(#401) #402
Conversation
Thanks for the patch but we use defer as it has better performacne in early Go days. I've did some benchmarks some time ago and still was a bit slower. Could you bench your changes? |
I conducted two benchmark tests each on macOS and Linux, with the following operating system and Go version: The summarized results are as follows:
The complete benchmark data is as follows:
|
Indeed it looks not that bad but I think since locking part is quite stable and we do not change often there is no need for sacrificing even 4% |
I believe it is necessary. As mentioned in the issue #401 , if a panic occurs between lock and unlock, the lock will never be released. Even if a panic is recovered externally, the program cannot continue running |
I think that this change is specific to your usage that involves using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1, there is no real need to convert everything to defer
. Everything works fine. Thank you.
No description provided.